package ls.controller;

import java.util.List;
import ls.model.Moaning;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;


@Controller
@RequestMapping("/search")
public class SearchController extends BaseController {
    protected static final String JSP_SEARCH = "search";
    protected static final String ATTR_MOANINGS = "moanings";

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView getSearch() {
        ModelAndView view = new ModelAndView(JSP_SEARCH);
        List<Moaning> moanings = getMoaningRepository().getMoanings();
        view.addObject(ATTR_MOANINGS, moanings);
        return view;
    }
}


